/*
 * Block.cpp
 *
 *  Created on: Apr 16, 2012
 *      Author: jaap
 */

#include "Block.h"

Block::Block(int number) {
	this->number = number;
	if(number==1){
		this->super=true;

	}
}



byte* Block::getBytes(int offset, int length) {
	byte buffer[INSIZ];
	for (int i = offset; i < offset + length; ++i) {
		buffer[i - offset] = bytes[i];
	}
	return buffer;
}

byte* Block::getBytes() {
	return bytes;
}

bool Block::isSuperBlock() {
	return (number == 1);
}

int Block::getAmountOfInodeBlocks() {
	assert(super);
	return getshort(bytes, 0);
}

int Block::getAmountOfBlocks() {
	assert(super);
	return getlong(bytes, 2);
}
